<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>倒计时时分秒</title>
	<style>
		*{padding:0;margin:0;}
		#did{
			width:200px;
			height:40px;
			line-height:40px;
			text-align:center;
			background-color:green;
		}
	</style>
</head>
<body>
	时：<input type="text" id="h" >分：<input type="text" id="m" >秒：<input type="text" id="s" ><br><br>
	<button onclick="start()" >开始</button>
	<button onclick="stop()" >暂停</button>
	<button onclick="jixu()" >继续</button><br><br>
	<div id="did" ></div>
</body>
	<script>
		did = document.getElementById("did");
		mytime = null;

		function demo(){
			s--;
			if(s<0){
				m--;
				s=59;
				if(m<0){
					h--;
					m=59;
					if(h<0){
						h=0;
						m=0;
						s=0;
						clearInterval(mytime);
					}
				}
			}
			did.innerHTML = h+"时"+m+"分"+s+"秒";
		}
		function start(){
			h = document.getElementById("h").value;
			m = document.getElementById("m").value;
			s = document.getElementById("s").value;
			if(mytime==null){
				mytime = setInterval(demo,1000);
			}
			
		}
		function stop(){
			clearInterval(mytime);
			mytime=null;
		}
		function jixu(){
			if(mytime==null){
				mytime = setInterval(demo,1000);
			}
		}
	</script>
</html>